#include "stdafx.h"
#include "playerTexture_t.h"


playerTexture_t::playerTexture_t()
{
	HTEXTURE t	=	hgeResMgr::GetSingleton()->GetTexture("pmClientRes\\playerTexture\\player1.png");
	HGE * hge = hgeCreate( HGE_VERSION );
	hgeSprite* spr = new hgeSprite( t, (float)0, (float)0, (float)hge->Texture_GetWidth(t), (float)hge->Texture_GetHeight(t) );
	texs.insert(make_pair("player1",spr));
}


playerTexture_t::~playerTexture_t()
{
}


extern	int			TILE_W;
extern	int			TILE_H;
int playerTexture_t::draw( string tex, int dir, int frame, int x, int y )
{
	mpt::iterator iter;
	iter = texs.find(tex);
	if (iter==texs.end())
	{
		return 0;
	}
	hgeSprite* spr = iter->second;
	HGE * hge = hgeCreate( HGE_VERSION );
	int w = hge->Texture_GetWidth(spr->GetTexture());
	int h = hge->Texture_GetHeight(spr->GetTexture());
	spr->SetTextureRect(frame*w/4, dir*h/4, w/4, h/4);
	spr->Render(x,y-(h/4-TILE_H));
	return 1;
}